﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using SeriesManager.Model;

namespace SeriesManager.Test.Model
{
    [TestClass]
    public class SeasonTest
    {
        #region Constructor tests

        [TestMethod]
        public void ConstructoTestSuccessfull()
        {
            Series series = new Series();
            Season target = new Season(series, 1);

            Assert.AreEqual(series, target.Series);
            Assert.AreEqual(1, target.Number);
            Assert.IsNotNull(target.Episodes);
        }

        #endregion

        #region AddEpisode tests

        [TestMethod]
        public void AddEpisodeTestSuccessfull()
        {
            Series series = new Series();
            Season target = new Season(series, 1);

            Episode dummy = new Episode();

            target.AddEpisode(dummy);

            Assert.AreEqual(series, target.Series);
            Assert.AreEqual(1, target.Number);
            Assert.IsNotNull(target.Episodes);
            Assert.AreEqual(1, target.Episodes.Count);
        }

        [TestMethod]
        [ExpectedException(typeof(ArgumentNullException))]
        public void AddEpisodeTestFailedNoEpisode()
        {
            Series series = new Series();
            Season target = new Season(series, 1);

            target.AddEpisode(null);
        }
        #endregion
    }
}
